+Wed Nov 12 21:40:10 2003 Matthias Clasen <maclas@gmx.de>
+
+ Changes to improve menu positioning on Xinerama (#108328):
+
+ * gtk/gtkmenu.c (struct _GtkMenuPrivate): Add a menu_num field
+ to store the monitor on which the menu is to be positioned.
+
+ * gtk/gtkmenu.[hc] (gtk_menu_position): Store the monitor number
+ in the GtkMenuPrivate struct and fetch the monitor geometry after
+ calling the position_func, in case it has been changed.
+
+ * gtk/gtkmenu.c (gtk_menu_set_monitor): New function
+ to be used in GtkMenuPositionFunc implementations for setting
+ the monitor_num field in GtkMenuPrivate.
+
+ * gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Call
+ gtk_menu_set_monitor.
+
Wed Nov 12 21:00:10 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkinputdialog.c (gtk_input_dialog_init): Clarify the
+Wed Nov 12 21:40:10 2003 Matthias Clasen <maclas@gmx.de>
+
+ Changes to improve menu positioning on Xinerama (#108328):
+
+ * gtk/gtkmenu.c (struct _GtkMenuPrivate): Add a menu_num field
+ to store the monitor on which the menu is to be positioned.
+
+ * gtk/gtkmenu.[hc] (gtk_menu_position): Store the monitor number
+ in the GtkMenuPrivate struct and fetch the monitor geometry after
+ calling the position_func, in case it has been changed.
+
+ * gtk/gtkmenu.c (gtk_menu_set_monitor): New function
+ to be used in GtkMenuPositionFunc implementations for setting
+ the monitor_num field in GtkMenuPrivate.
+
+ * gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Call
+ gtk_menu_set_monitor.
+
Wed Nov 12 21:00:10 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkinputdialog.c (gtk_input_dialog_init): Clarify the
+Wed Nov 12 21:40:10 2003 Matthias Clasen <maclas@gmx.de>
+
+ Changes to improve menu positioning on Xinerama (#108328):
+
+ * gtk/gtkmenu.c (struct _GtkMenuPrivate): Add a menu_num field
+ to store the monitor on which the menu is to be positioned.
+
+ * gtk/gtkmenu.[hc] (gtk_menu_position): Store the monitor number
+ in the GtkMenuPrivate struct and fetch the monitor geometry after
+ calling the position_func, in case it has been changed.
+
+ * gtk/gtkmenu.c (gtk_menu_set_monitor): New function
+ to be used in GtkMenuPositionFunc implementations for setting
+ the monitor_num field in GtkMenuPrivate.
+
+ * gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Call
+ gtk_menu_set_monitor.
+
Wed Nov 12 21:00:10 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkinputdialog.c (gtk_input_dialog_init): Clarify the
+Wed Nov 12 21:40:10 2003 Matthias Clasen <maclas@gmx.de>
+
+ Changes to improve menu positioning on Xinerama (#108328):
+
+ * gtk/gtkmenu.c (struct _GtkMenuPrivate): Add a menu_num field
+ to store the monitor on which the menu is to be positioned.
+
+ * gtk/gtkmenu.[hc] (gtk_menu_position): Store the monitor number
+ in the GtkMenuPrivate struct and fetch the monitor geometry after
+ calling the position_func, in case it has been changed.
+
+ * gtk/gtkmenu.c (gtk_menu_set_monitor): New function
+ to be used in GtkMenuPositionFunc implementations for setting
+ the monitor_num field in GtkMenuPrivate.
+
+ * gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Call
+ gtk_menu_set_monitor.
+
Wed Nov 12 21:00:10 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkinputdialog.c (gtk_input_dialog_init): Clarify the
+Wed Nov 12 21:40:10 2003 Matthias Clasen <maclas@gmx.de>
+
+ Changes to improve menu positioning on Xinerama (#108328):
+
+ * gtk/gtkmenu.c (struct _GtkMenuPrivate): Add a menu_num field
+ to store the monitor on which the menu is to be positioned.
+
+ * gtk/gtkmenu.[hc] (gtk_menu_position): Store the monitor number
+ in the GtkMenuPrivate struct and fetch the monitor geometry after
+ calling the position_func, in case it has been changed.
+
+ * gtk/gtkmenu.c (gtk_menu_set_monitor): New function
+ to be used in GtkMenuPositionFunc implementations for setting
+ the monitor_num field in GtkMenuPrivate.
+
+ * gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Call
+ gtk_menu_set_monitor.
+
Wed Nov 12 21:00:10 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkinputdialog.c (gtk_input_dialog_init): Clarify the
+Wed Nov 12 21:52:35 2003 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/gtk-sections.txt: Add gtk_menu_set_monitor.
+
Fri Oct 24 13:15:32 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/tmpl/gtktoolbar.sgml, gtk/tmpl/gtkseparatortoolitem.sgml:
gtk_menu_get_attach_widget
GtkMenuPositionFunc
GtkMenuDetachFunc
+gtk_menu_set_monitor
<SUBSECTION Standard>
GTK_MENU
GTK_IS_MENU
guint *heights;
gint heights_length;
+
+ gint monitor_num;
};
typedef struct
GdkScreen *screen;
GdkScreen *pointer_screen;
GdkRectangle monitor;
- gint monitor_num;
g_return_if_fail (GTK_IS_MENU (menu));
y = MAX (0, (gdk_screen_get_height (screen) - requisition.height) / 2);
}
- monitor_num = gdk_screen_get_monitor_at_point (screen, x, y);
- gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
+ private = gtk_menu_get_private (menu);
+ private->monitor_num = gdk_screen_get_monitor_at_point (screen, x, y);
push_in = FALSE;
if (menu->position_func)
- (* menu->position_func) (menu, &x, &y, &push_in, menu->position_func_data);
+ {
+ (* menu->position_func) (menu, &x, &y, &push_in, menu->position_func_data);
+ gdk_screen_get_monitor_geometry (screen, private->monitor_num, &monitor);
+ }
else
{
gint space_left, space_right, space_above, space_below;
* Positioning in the vertical direction is similar: first try below
* mouse cursor, then above.
*/
+ gdk_screen_get_monitor_geometry (screen, private->monitor_num, &monitor);
+
space_left = x - monitor.x;
space_right = monitor.x + monitor.width - x - 1;
space_above = y - monitor.y;
if (GTK_MENU_SHELL (menu)->active)
{
- private = gtk_menu_get_private (menu);
private->have_position = TRUE;
private->x = x;
private->y = y;
break;
}
}
+
+
+/**
+ * gtk_menu_set_monitor:
+ * @menu: a #GtkMenu
+ * @monitor_num: the number of the monitor on which the menu should
+ * be popped up
+ *
+ * Informs GTK+ on which monitor a menu should be popped up.
+ * See gdk_screen_get_monitor_geometry().
+ *
+ * This function should be called from a #GtkMenuPositionFunc if the
+ * menu should not appear on the same monitor as the pointer. This
+ * information can't be reliably inferred from the coordinates returned
+ * by a #GtkMenuPositionFunc, since, for very long menus, these coordinates
+ * may extend beyond the monitor boundaries or even the screen boundaries.
+ *
+ * Since: 2.4
+ **/
+void gtk_menu_set_monitor (GtkMenu *menu,
+ gint monitor_num)
+{
+ GtkMenuPrivate *priv;
+ g_return_if_fail (GTK_IS_MENU (menu));
+
+ priv = gtk_menu_get_private (menu);
+
+ priv->monitor_num = monitor_num;
+}
guint top_attach,
guint bottom_attach);
+void gtk_menu_set_monitor (GtkMenu *menu,
+ gint monitor_num);
#ifndef GTK_DISABLE_DEPRECATED
#define gtk_menu_append(menu,child) gtk_menu_shell_append ((GtkMenuShell *)(menu),(child))
*/
*x = CLAMP (tx, monitor.x, MAX (monitor.x, monitor.x + monitor.width - twidth));
*y = ty;
+
+ gtk_menu_set_monitor (menu, monitor_num);
}
/**